home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / bash / bash_108 / bash-108.zoo / bash-1.08 / makeargs.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1991-05-19  |  4.4 KB  |  164 lines

  1. #!/bin/sh
  2. #
  3. # This file creates a file called "sysdefs.h" which contains CPP defines
  4. # helping to describe the operating system features.  We just take guesses
  5. # by looking at random files.
  6.  
  7. if [ "$1" ]; then
  8.   sysdefs=$1
  9. else
  10.   sysdefs=./sysdefs.h
  11. fi
  12.  
  13. rm -f $sysdefs
  14.  
  15. echo "/* sysdefs.h -- #defines for your system created by $0."    >>$sysdefs
  16. echo "   Do NOT EDIT this file, since any changes will disappear." >>$sysdefs
  17. echo "   Instead, edit $0, or config.h, or machines.h. */"    >>$sysdefs
  18. echo ""                        >>$sysdefs
  19. echo "#if !defined (_SYSDEFS_H_)"        >>$sysdefs
  20. echo "#define _SYSDEFS_H_"            >>$sysdefs
  21.  
  22. # Removes any inherited definitions.
  23. SHLIB=
  24. SYSDEF=
  25.  
  26. # Test for shared libraries (this is pretty Sunish).
  27. if test -f /lib/ld.so; then
  28.   SHLIB=-DHAVE_SHARED_LIBS
  29.   echo ""                    >>$sysdefs
  30.   echo "#define HAVE_SHARED_LIBS"        >>$sysdefs
  31. fi
  32.  
  33. # Test for shared libraries (this is pretty sVr4ish).
  34. if test -f /usr/ccs/lib/libc.so; then
  35.   SHLIB=-DHAVE_SHARED_LIBS
  36.   echo ""                    >>$sysdefs
  37.   echo "#if !defined (HAVE_SHARED_LIBS)"    >>$sysdefs
  38.   echo "# define HAVE_SHARED_LIBS"        >>$sysdefs
  39.   echo "#endif /* HAVE_SHARED_LIBS */"        >>$sysdefs
  40.   SYSDEF=-DUSGr4
  41. fi
  42.  
  43. # Get name of maintainer.
  44. if (whoami) >/dev/null 2>&1 && (hostname) >/dev/null 2>&1; then
  45.   WHOAMI=`whoami`@`hostname`;
  46. else
  47.   WHOAMI=`who am i | awk '{ print $1; }'`
  48. fi
  49.  
  50. if [ "$WHOAMI" = "" ]; then 
  51.   WHOAMI=`id | sed 's/uid=[01-9]*(//' | sed 's/) [) A-Za-z01-9(=,]*//'`
  52.   if (hostname) >/dev/null 2>&1; then
  53.     WHOAMI=$WHOAMI@`hostname`
  54.   elif test -f /usr/bin/uuname -o -f /bin/uuname; then
  55.     WHOAMI=`uuname -l`!$WHOAMI
  56.   fi
  57. fi
  58.  
  59. if [ "$WHOAMI" = "" ]; then
  60.   WHOAMI=root
  61. fi
  62.  
  63. echo ""                        >>$sysdefs
  64. echo "#if !defined (MAINTAINER)"        >>$sysdefs
  65. echo "# define MAINTAINER $WHOAMI"        >>$sysdefs
  66. echo "#endif /* MAINTAINER */"            >>$sysdefs
  67.  
  68. # Try to locate ranlib.  I think this is a bad idea.
  69. if [ -r /usr/bin/ranlib ]; then RANLIB_LOCATION=/usr/bin/ranlib;
  70. elif [ -r /bin/ranlib ]; then RANLIB_LOCATION=/bin/ranlib;
  71. elif [ -r /usr/local/bin/ranlib ]; then RANLIB_LOCATION=/usr/local/bin/ranlib;
  72. elif [ -r /usr/local/gnubin/ranlib ]; then RANLIB_LOCATION=/usr/local/gnubin/ranlib;
  73. fi
  74.  
  75. # Does this system have /bin/csh?  We don't care about other csh's.
  76. if [ -f /bin/csh ]; then
  77.   echo ""                        >>$sysdefs
  78.   echo "#if !defined (HAVE_CSH)"             >>$sysdefs
  79.   echo "# define HAVE_CSH"                >>$sysdefs
  80.   echo "#endif /* HAVE_CSH */"                 >>$sysdefs
  81. fi
  82.  
  83. if [ "${RANLIB_LOCATION}" ]; then
  84.   echo ""                        >>$sysdefs
  85.   echo "#if !defined (RANLIB_LOCATION)"         >>$sysdefs
  86.   echo "# define RANLIB_LOCATION ${RANLIB_LOCATION}"    >>$sysdefs
  87.   echo "#endif /* RANLIB_LOCATION */"             >>$sysdefs
  88. fi
  89.  
  90. #
  91. # Is this a Xenix system?
  92. #
  93. if [ -f /xenix ]; then
  94.   SYSDEF="Xenix"
  95.  case "`uname -p`" in
  96.   *286) SYSDEF="Xenix286" ;;
  97.   *386) SYSDEF="Xenix386" ;;
  98.  esac
  99. fi
  100.  
  101. #
  102. # Is this a cadmus system?
  103. #
  104. if [ -f /unix ]; then
  105.   if [ -d /generic ]; then   # This is an AIX system.
  106.     SYSDEF="aixpc"
  107.   elif [ -d /etc/conf/kconfig.d ]; then     # This is a 386 running ISC?
  108.     SYSDEF="isc386"
  109.   elif [ -f /etc/elc.cfg ]; then
  110.     if fgrep _IBMR2 /etc/xlc.cfg >/dev/null 2>&1; then
  111.       SYSDEF=RISC6000
  112.     fi
  113.   else
  114.     SYSDEF="cadmus"
  115.  
  116.     if [ -f /shlib/libc_s ]; then
  117.       SHLIB=-DHAVE_SHARED_LIBS
  118.       echo ""                    >>$sysdefs
  119.       echo "#if !defined (HAVE_SHARED_LIBS)"    >>$sysdefs
  120.       echo "# define HAVE_SHARED_LIBS"        >>$sysdefs
  121.       echo "#endif /* HAVE_SHARED_LIBS */"    >>$sysdefs
  122.     fi
  123.   fi
  124. fi
  125.  
  126. if [ "$SYSDEF" != "" ]; then
  127.   echo ""                    >>$sysdefs
  128.   echo "#define $SYSDEF"            >>$sysdefs
  129. fi
  130.  
  131. if [ -f /usr/include/unistd.h ]; then
  132.   echo ""                    >>$sysdefs
  133.   echo "#if !defined (HAVE_UNISTD_H)"        >>$sysdefs
  134.   echo "# define HAVE_UNISTD_H"            >>$sysdefs
  135.   echo "#endif /* HAVE_UNISTD_H */"        >>$sysdefs
  136. fi
  137.  
  138. if [ -f /usr/include/sys/wait.h ]; then
  139.   echo ""                    >>$sysdefs
  140.   echo "#if !defined (HAVE_WAIT_H)"        >>$sysdefs
  141.   echo "# define HAVE_WAIT_H"            >>$sysdefs
  142.   echo "#endif /* HAVE_WAIT_H */"        >>$sysdefs
  143. fi
  144.  
  145. if [ -f /usr/include/alloca.h ]; then
  146.   echo ""                    >>$sysdefs
  147.   echo "#if !defined (HAVE_ALLOCA_H)"        >>$sysdefs
  148.   echo "# define HAVE_ALLOCA_H"            >>$sysdefs
  149.   echo "#endif /* HAVE_ALLOCA_H */"        >>$sysdefs
  150. fi
  151.  
  152. if [ -f /usr/include/sys/resource.h ]; then
  153.   echo ""                    >>$sysdefs
  154.   echo "#if !defined (HAVE_RESOURCE)"        >>$sysdefs
  155.   echo "# define HAVE_RESOURCE"            >>$sysdefs
  156.   echo "#endif /* HAVE_RESOURCE */"        >>$sysdefs
  157. else
  158.   RESOURCE=
  159. fi
  160.  
  161. # These should be the last 2 lines in this file!
  162. echo ""                        >>$sysdefs
  163. echo "#endif /* _SYSDEFS_H_ */"            >>$sysdefs
  164.